package org.thirdHero.core.util;

import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class XmlUtils {
    public static String doXml2(HttpServletRequest request) {
        String result = "";
        InputStream inStream = null;
        try {
            inStream = request.getInputStream();

            ByteArrayOutputStream outSteam = new ByteArrayOutputStream();
            byte[] buffer = new byte[1024];
            int len = 0;
            while ((len = inStream.read(buffer)) != -1) {
                outSteam.write(buffer, 0, len);
            }
            outSteam.close();
            inStream.close();
            result = new String(outSteam.toByteArray(), "utf-8");

        } catch (IOException e) {
            e.printStackTrace();
        }
        return result;
    }
}
